package com.rickie.extension.point;

import com.alibaba.cola.extension.Extension;
import com.rickie.dto.command.CargoBookCmd;
import com.rickie.extension.IBookingPreValidateExtPt;
import com.rickie.extension.constant.Constants;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 预订亚马逊下单前检查逻辑实现
 *
 * @author zemin.liu
 * @date 2023-02-27 18:03
 */
@Extension(bizId = Constants.BIZ_BOOKING, useCase = Constants.USE_CASE_BOOKING, scenario = Constants.BOOKING_AMAZON)
@Slf4j
public class AmazonBookingValidateExt implements IBookingPreValidateExtPt {
    Logger logger = LoggerFactory.getLogger(AmazonBookingValidateExt.class);

    @Override
    public boolean validate(CargoBookCmd cmd) {
        // 此方法表示，在下某平台单时，需要在平台检查预订编号，货物信息合法
        // 这里采用策略模式，由接口名称、bizId、useCase、scenario组成key从Map中动态找到IBookingPreValidateExtPt的实现类
        logger.info("预订亚马逊下单前检查逻辑实现");
        return true;
    }
}
